import 'package:wanxiang_app/generated/json/base/json_field.dart';
import 'package:wanxiang_app/generated/json/category_entity.g.dart';
import 'dart:convert';

@JsonSerializable()
class CategoryEntity {
	late int code;
	late String msg;
	late List<CategoryData> data;

	CategoryEntity();

	factory CategoryEntity.fromJson(Map<String, dynamic> json) => $CategoryEntityFromJson(json);

	Map<String, dynamic> toJson() => $CategoryEntityToJson(this);

	@override
	String toString() {
		return jsonEncode(this);
	}
}

@JsonSerializable()
class CategoryData {
	late int id;
	late String title;
	@JSONField(name: "channel_id")
	late int channelId;
	@JSONField(name: "parent_id")
	late int parentId;
	CategoryData();

	factory CategoryData.fromJson(Map<String, dynamic> json) => $CategoryDataFromJson(json);

	Map<String, dynamic> toJson() => $CategoryDataToJson(this);

	@override
	String toString() {
		return jsonEncode(this);
	}
}